Talk type image
WORKSHOP

Embedding of Domain-Specific Languages in Scala

Embedded DSLs, Scala 3, Tagless-Final, Jq, fs2
Max. attendees: 10
Wednesday 2nd - 09:00 to 17:00

This course takes advantage of functional programming techniques in the design of domain-specific languages. In particular, it shows how to exploit the tagless-final style in the specification of the syntax, type system and semantics of embedded DSLs. The workshop will illustrate the different concerns in the design of embedded DSLs with the embedding of the jq language in Scala, including different semantics based on standard streams and the fs2 library. We will also pay particular attention to some of the new features of Scala 3, like match types, enums, extension methods, etc.

What attendees will learn

At the end of the course you should be able to:

  • Understand how to approach the design of embedded DSLs in a principled way
  • Understand how to approach the implementation of the different concerns of DSL design using the tagless-final style
  • Put into practice functional abstractions (higher-order functions, type classes, etc.) in the design of DSLs, the main goal of functional programming!

Requirements for the workshop

Laptop is required.

Agenda/Plan for the workshop

The workshop is structured into four major modules. Each module will cover a partial implementation of the jq embedding in Scala.

Module 1. Ad-hoc embedding
A jq embedding specially tailored to the fs2 streaming library

Module 2. Domain abstraction
Abstracting away the semantic domain, using type-classes

Module 3. Dynamic errors
Adding dynamic typing to the embedding

Module 4. Static typing
Adding static typing to the embedding using Scala 3match types.

Target audience roles

This is an intermediate level course. In particular, it assumes familiarity with Scala and basic functional programming techniques: algebraic data types, higher-order functions and type classes.

50% of the proceeds of this workshop will be donated to the NGO MSF (Médicos sin Fronteras).